
<script setup>
import { ref, computed } from "vue";

const list = ref([1, 2, 3, 4, 5, 6, 7, 8, 9])

const filterList = computed(() => {

  return list.value.filter(item => item >2 )
})

//完整写法
const isChecked = ref(false)
const isCheckedComp = computed({
  get() {
    //动态变化
    return isChecked.value
 
  },
  set(val) {
    //动态变化
    isChecked.value = val
  }
})
</script>
<template>
  <div>
    原始数据：{{ list }} 计算属性：{{ filterList }}
    <br />
    <input type="checkbox" v-model="isCheckedComp" />
  </div>
</template>
<style scoped>
</style>

